﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using SessionLIB;

namespace NascarEventsWPF
{
    /// <summary>
    /// Interaction logic for Page4_Session.xaml
    /// </summary>
    public partial class Page4_Session : Window
    {
        public Page4_Session()
        {
            InitializeComponent();
        }

   //populates datagrids based on userID entered in search box  
        private void sessionsearch_btn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                SessionClass session_obj = new SessionClass(Convert.ToInt32(session_search_txt.Text));
                session_search_userinfo_txt.Text = session_obj.GetUser();
                session_all_grps_dg.ItemsSource = session_obj.GetGroups().DefaultView;
                session_all_attrib_dg.ItemsSource = session_obj.GetAttributes().DefaultView;
                session_top_attributes_dg.ItemsSource = session_obj.GetHighestRankedUserAttributes().DefaultView;
            }
            catch (Exception ex)
            {
                session_search_userinfo_txt.Text = "Sorry ID not found. Please enter valid userID";
                //MessageBox.Show(ex.Message);

            }

        }


       
    }
}
